<?php
namespace app\index\controller;
use app\common\facade\Sys;
use think\cache\driver\Redis;
use think\Container;
use think\Controller;
use think\facade\Log;


class Index extends Controller
{
    public function index()
    {

        $res='that';
        return $res?:'where';

        echo url('app/route',"name=vhare")."<br/><br/>";
        return;

        $object=db('isgoods_attr');
        $map[]=['id','=',64];
        //$res=$object->where($map)->dec('stock',15)->update();
        $object->where($map)->find();
        echo $object->getlastsql()."<br/><br/>";

        $res=$object->removeOption()->where($map)->setInc('stock',5,5);
        echo $object->getlastsql()."<br/><br/>";


        $res=app()->cache->store('redis')->get('redis_test');
        if(!$res)return 'fail';

        echo $res;
        return;

        return '<style type="text/css">*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} a{color:#2E5CD5;cursor: pointer;text-decoration: none} a:hover{text-decoration:underline; } body{ background: #fff; font-family: "Century Gothic","Microsoft yahei"; color: #333;font-size:18px;} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.6em; font-size: 42px }</style><div style="padding: 24px 48px;"> <h1>:) </h1><p> ThinkPHP V5.1<br/><span style="font-size:30px">12载初心不改（2006-2018） - 你值得信赖的PHP框架</span></p><a href="https://www.kancloud.cn/manual/thinkphp5_1/353946" target="_blank">开发手册</a>&nbsp;&nbsp;<a href="https://www.kancloud.cn/manual/thinkphp5_1/" target="_blank">框架介绍</a></div><script type="text/javascript" src="https://tajs.qq.com/stats?sId=64890268" charset="UTF-8"></script><script type="text/javascript" src="https://e.topthink.com/Public/static/client.js"></script><think id="eab4b9f840753f8e7"></think>';
    }



    public function think(){
        echo $this->request->InApp;
        return 'middleware jump';
    }

    public function sys(){
        $res= Sys::sysinfo();
        print_r($res);
    }

    public function tpl(){
        // 直接渲染内容
        $content = '{$name}-{$email}';
        return $this->display($content, ['name' => 'thinkphp', 'email' => 'thinkphp@qq.com']);
    }

    public function layout(){
        return $this->fetch();
    }

    //接口调用，需要php5.6以上版本
    public function api(){
        //$client = new Client("1c07101ddab0ad0dd662a5ed0bd0af8d");

        $result = api()->jokeRand()
            ->request();

        dump($result);
    }




}